<?php
namespace common\models;

use Yii;

/**
 * This is the model class for table "collect".
 *
 * @property integer $id
 * @property integer $gid
 * @property integer $uid
 */
class Collect extends \yii\db\ActiveRecord
{

    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'collect';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [
                [
                    'gid',
                    'uid'
                ],
                'required'
            ],
            [
                [
                    'gid',
                    'uid'
                ],
                'integer'
            ]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'gid' => 'Gid',
            'uid' => 'Uid'
        ];
    }
    public function getGoods()
    {
        return $this->hasOne(Goods::className(), [
            'id' => 'gid'
        ])->select('id,name,price,logo');
    }
}
